#ifndef ISO_MOVABLE_H
#define ISO_MOVABLE_H

#include <bn_array.h>
#include <bn_sprite_animate_actions.h>
#include <bn_sprite_item.h>
#include <bn_unordered_map.h>

#include "iso_static.h"

class movableSprite : public staticSprite
{
private:
    bool canMove;
    int speed;
    bn::optional<bn::sprite_animate_action<4>> moveAnimation;
    bn::optional<bn::sprite_tiles_item> animationTilesItem;

public:
    enum Direction
    {
        Up,
        Left,
        Right,
        Down,
        Count
    };

private:
    Direction dir;
    bn::unordered_map<Direction, bn::array<int, 4>, Direction::Count> animationFrames;

public:
    movableSprite(const int posX, const int posY, const bn::sprite_item& movableItem, const int collisionWidth, const int collisionHeight, const int moveSpeed, const int spriteHeight = {});
    ~movableSprite() = default;

    void setDirection(const Direction& newDir);
    void setAsMovable(const bool canMove_);
    void setMoveAnimation();
    void setStaticFrame();

    void draw() override;
    void update() override;
};

#endif // ISO_MOVABLE_H
